package com.zhy.sunmi.utils;

import android.content.Context;
import android.os.Build;
import android.telephony.TelephonyManager;

import java.lang.reflect.Method;

import static android.content.Context.TELEPHONY_SERVICE;

/**
 * @ClassName ScreenUtils
 * @Description TODO
 * @Author zhouhongyang
 * @DATE 2021/9/7 8:03 下午
 * @Version 1.0
 */
public class ScreenUtils {

    /**
     * 获取屏幕高度(px)
     */
    public static int getScreenHeight(Context context) {
        return context.getResources().getDisplayMetrics().heightPixels;
    }
    /**
     * 获取屏幕宽度(px)
     */
    public static int getScreenWidth(Context context) {
        return context.getResources().getDisplayMetrics().widthPixels;
    }

    public static String getMachineSN(Context context){
        try {
            Class c = Class.forName("android.os.SystemProperties");
            Method get = c.getMethod("get", String.class);

            //获取SN码
            String MachineSN = (String) get.invoke(c, "ro.serialno");

            return MachineSN;
        } catch (Exception e) {
            e.printStackTrace();
        }
            return "DA04215T40075";
    }


}


